package instrucciones;

public class Tipo_R extends Instruccion {

	private String regS;
	private String regT;
	private String regD;
	private String shift;
	private String funcion;
	
	public Tipo_R(String opcode, String rs, String rt, String rd, String despl, String func) 
	{
		super(opcode);
		this.regS = rs;
		this.regT = rt;
		this.regD = rd;
		this.shift = despl;
		this.funcion = func;
	}

	public void Transformar() {
		
		instruccionBinario = (	 String.format("%1$6s",Integer.toBinaryString(Integer.parseInt(opcode))).replace(' ', '0') + 
								 String.format("%1$5s",Integer.toBinaryString(Integer.parseInt(regS))).replace(' ', '0') +
								 String.format("%1$5s",Integer.toBinaryString(Integer.parseInt(regT))).replace(' ', '0') +
								 String.format("%1$5s",Integer.toBinaryString(Integer.parseInt(regD))).replace(' ', '0') +
								 String.format("%1$5s",Integer.toBinaryString(Integer.parseInt(shift))).replace(' ', '0') +
								 String.format("%1$6s",Integer.toBinaryString(Integer.parseInt(funcion))).replace(' ', '0'));
		DarFormatoArchivo();
	
	}

}
